Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClientOptions["cloud"] should have optional auth fields #1032

Merged
merged 1 commit into from
Jan 7, 2020

Conversation

pickypg
Copy link
Member

@pickypg pickypg commented Dec 20, 2019

This changes the optional username and password under cloud to actually be optional.

  cloud?: {
    id: string;
    // TODO: remove username and password here in 8
-    username: string;
-    password: string;
+    username?: string;
+    password?: string;
  }

This lets the documented workflow where the cloud.id is specified along with traditional auth work in TypeScript without cheating.

Prior to this PR, the workaround is:

  return new Client({
    cloud: {
      id: env.CLOUD_ID,
    } as ClientOptions['cloud'], // note: in 7.5.0 it has the optional user/pass as not optional
    auth: {
      username: env.USERNAME,
      password: env.PASSWORD,
    },
  });

This changes the optional username and password under `cloud` to actually be optional.

```diff
  cloud?: {
    id: string;
    // TODO: remove username and password here in 8
-    username: string;
-    password: string;
+    username?: string;
+    password?: string;
  }
```

This lets the documented workflow where the `cloud.id` is specified along with traditional `auth` work in TypeScript without cheating. The workaround to it is:

```ts
  return new Client({
    cloud: {
      id: env.CLOUD_ID,
    } as ClientOptions['cloud'], // note: in 7.5.0 it has the optional user/pass as not optional
    auth: {
      username: env.USERNAME,
      password: env.PASSWORD,
    },
  });
```
Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants